<template>
  <div v-show="list.length">
    <Product v-for="item of list" :info="item" :key="item.id"></Product>
  </div>
</template>

<script>
import Product from '../components/product.vue'
export default {
  components: { Product },
  computed: {
    list () {
      // 从vuex中获取商品数据
      return this.$store.state.productList
    }
  },
  mounted () {
    // 初始化 通过vuex的action请求数据
    this.$store.dispatch('getProductList')
  }
}
</script>

<style>
</style>
